System and method for performing connection validation in a multi-tenant environment

ABSTRACT

Described herein are systems and methods for providing access to a database in a multi-tenant environment, including the use of a connection pool, and support for efficient connection validation. For example, the system can support a “seconds to trust idle connection” functionality, which enables lazy validation of connections in the connection pool. The seconds to trust idle connection is the time period, expressed, for example, as a number of seconds, within a particular connection usage, that the connection pool trusts that the connection is still viable, and if so will skip a connection validation test before delivering the connection to a requesting application.

CLAIM OF PRIORITY

This application claims the benefit of priority to U.S. ProvisionalApplication titled “SYSTEM AND METHOD FOR PERFORMING EFFICIENTCONNECTION VALIDATION IN A MULTI-TENANT ENVIRONMENT”, Application No.62/374,487, filed Aug. 12, 2016, which is herein incorporated byreference.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is related to U.S. application Ser. No. ______, titled“SYSTEM AND METHOD FOR SUPPORTING LIVE ADDITION OF A TENANT IN ACONNECTION POOL ENVIRONMENT”, filed (Attorney Docket No.:ORACL-05742US1); U.S. application Ser. No. ______, titled “SYSTEM ANDMETHOD FOR CONTROL OF MAXIMUM CONNECTIONS IN A CONNECTION POOLENVIRONMENT”, filed (Attorney Docket No.: ORACL-05743US1); and U.S.application Ser. No. ______, titled “SYSTEM AND METHOD FOR USE OFSERVER-SIDE CONNECTION POOL TAGGING IN A MULTI-TENANT ENVIRONMENT”,filed (Attorney Docket No.: ORACL-05747US1); each of which aboveapplications is herein incorporated by reference.

COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains materialwhich is subject to copyright protection. The copyright owner has noobjection to the facsimile reproduction by anyone of the patent documentor the patent disclosure, as it appears in the Patent and TrademarkOffice patent file or records, but otherwise reserves all copyrightrights whatsoever.

FIELD OF INVENTION

Embodiments of the invention are generally related to softwareapplication servers and databases, and are particularly related tosystems and methods for providing access to a database in a multi-tenantenvironment, including the use of a connection pool, and additionalfunctionalities.

BACKGROUND

Generally described, in a database environment, a connection pooloperates as a cache of connection objects, each of which represents aconnection that can be used by a software application to connect to adatabase. At runtime, an application can request a connection from theconnection pool. If the connection pool includes a connection that cansatisfy the particular request, it can return that connection to theapplication for its use. In some instances, if no suitable connection isfound, then a new connection can be created and returned to theapplication. The application can borrow the connection to access thedatabase and perform some work, and then return the connection to thepool, where it can then be made available for subsequent connectionrequests from the same, or from other, applications.

SUMMARY

Described herein are systems and methods for providing access to adatabase in a multi-tenant environment, including the use of aconnection pool, and support for efficient connection validation. Forexample, the system can support a “seconds to trust idle connection”functionality, which enables lazy validation of connections in theconnection pool. The seconds to trust idle connection is the timeperiod, expressed, for example, as a number of seconds, within aparticular connection usage, that the connection pool trusts that theconnection is still viable, and if so will skip a connection validationtest before delivering the connection to a requesting application.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 illustrates a system that includes a connection pool, inaccordance with an embodiment.

FIG. 2 further illustrates a system that includes a connection pool,including support for use of a sharded database, in accordance with anembodiment.

FIG. 3 further illustrates a system that includes a connection pool,including support for use in a multi-tenant environment, in accordancewith an embodiment.

FIG. 4 illustrates an embodiment which supports connection validation,in a connection pool environment.

FIG. 5 further illustrates an embodiment which supports connectionvalidation, in a connection pool environment.

FIG. 6 further illustrates an embodiment which supports connectionvalidation, in a connection pool environment.

FIG. 7 illustrates a process for providing connection validation, inaccordance with an embodiment.

FIG. 8 illustrates a method of providing connection validation, in aconnection pool environment, in accordance with an embodiment.

DETAILED DESCRIPTION

As described above, a connection pool operates as a cache of connectionobjects, each of which represents a connection that can be used by asoftware application to connect to a database. At runtime, anapplication can request a connection from the connection pool. If theconnection pool includes a connection that can satisfy the particularrequest, it can return that connection to the application for its use.In some instances, if no suitable connection is found, then a newconnection can be created and returned to the application. Theapplication can borrow the connection to access the database and performsome work, and then return the connection to the pool, where it can thenbe made available for subsequent connection requests from the same, orfrom other, applications.

Creating connection objects can be costly in terms of time andresources. For example, tasks such as network communication,authentication, transaction enlistment, and memory allocation, allcontribute to the amount of time and resources it takes to create aparticular connection object. Since connection pools allow the reuse ofsuch connection objects, they help reduce the number of times that thevarious objects must be created.

One example of a connection pool is Oracle Universal Connection Pool(UCP), which provides a connection pool for caching Java DatabaseConnectivity (JDBC) connections. For example, the connection pool canoperate with a JDBC driver to create connections to a database, whichare then maintained by the pool; and can be configured with propertiesthat are used to further optimize pool behavior, based on theperformance and availability requirements of a requesting softwareapplication.

Connection Labeling

FIG. 1 illustrates a system that includes a connection pool, inaccordance with an embodiment.

As illustrated in FIG. 1, in accordance with an embodiment, anapplication server or database environment 100, which includes physicalcomputer resources 101 (e.g., a processor/CPU, memory, and networkcomponents), for example an Oracle WebLogic Server, Oracle FusionMiddleware, or other application server or database environment, caninclude or provide access to a database 102, for example an Oracledatabase, or other type of database.

As further illustrated in FIG. 1, in accordance with an embodiment, thesystem also includes a connection pool logic 104 or program code, whichwhen executed by a computer controls 105 the creation and use ofconnection objects in a connection pool 106, including, for example,connections that are currently in use 108 by a software application, andconnections that are idle 110, or are not currently being used.

Software applications can initialize connections retrieved from aconnection pool, before using the connection to access, or perform workat the database. Examples of initialization can include simple statere-initializations that require method calls within the applicationcode, or more complex initializations including database operations thatrequire round trips over a network. The computational cost of theselatter types of initialization may be significant.

Some connection pools (for example, UCP) allow their connection pools tobe configured using connection pool properties, that have get and setmethods, and that are available through a pool-enabled data sourceinstance. These get and set methods provide a convenient way toprogrammatically configure a pool. If no pool properties are set, then aconnection pool uses default property values.

In accordance with an embodiment, labeling connections allows a clientsoftware application to attach arbitrary name/value pairs to aconnection. The application can then request a connection with a desiredlabel from the connection pool. By associating particular labels withparticular connection states, an application can potentially retrieve analready-initialized connection from the pool, and avoid the time andcost of re-initialization. Connection labeling does not impose anymeaning on user-defined keys or values; the meaning of any user-definedkeys and values is defined solely by the application.

For example, as illustrated in FIG. 1, in accordance with an embodiment,the connection pool can include a plurality of connections that arecurrently in use by software applications, here indicated as connectionsA 112 and B 114. Each of the connections can be labeled, for exampleconnection A is labeled (Blue) and connection B is labeled (Green).These labels/colors are provided for purposes of illustration, and asdescribed above can be arbitrary name/value pairs attached to aconnection by a client application. In accordance with variousembodiments, different types of labels can be used, to distinguishbetween different connection types; and different applications canattach different labels/colors to a particular connection type.

As further illustrated in FIG. 1, in accordance with an embodiment, theconnection pool can also include a plurality of connections that areidle, or are not currently being used by software applications, hereindicated as connections C 116, D 118, E 120, F 122, G 124 and N 126.Each of the idle connections can be similarly labeled, in thisillustration as (Blue) or (Green), and again these labels/colors areprovided for purposes of illustration.

As further illustrated in FIG. 1, in accordance with an embodiment, if asoftware application 130 wishes to make a request on the database, usinga particular type of connection, for example a (Red) connection, thenthe application can make a “getConnection(Red)” request 132. Inresponse, the connection pool logic will either create a new (Red)connection, here indicated as X 134 (Red); or repurpose an existing idleconnection from (Blue or Green) to (Red), here indicated as E 135 (Red).

Sharded Databases

In accordance with an embodiment, sharding is a database-scalingtechnique which uses a horizontal partitioning of data across multipleindependent physical databases. The part of the data which is stored ineach physical database is referred to as a shard. From the perspectiveof a software client application, the collection of all of the physicaldatabases appears as a single logical database.

In accordance with an embodiment, the system can include support for useof a connection pool with sharded databases. A shard director orlistener provides access by software client applications to databaseshards. A connection pool (e.g., UCP) and database driver (e.g., a JDBCdriver) can be configured to allow a client application to provide ashard key, either during connection checkout or at a later time;recognize shard keys specified by the client application; and enableconnection by the client application to a particular shard or chunk. Theapproach enables efficient re-use of connection resources, and fasteraccess to appropriate shards.

FIG. 2 further illustrates a system that includes a connection pool,including support for use of a sharded database, in accordance with anembodiment.

In accordance with an embodiment, a database table can be partitionedusing a shard key (SHARD_KEY), for example as one or more columns thatdetermine, within a particular shard, where each row is stored. A shardkey can be provided in a connect string or description as an attributeof connect data (CONNECT_DATA). Examples of shard keys can include aVARCHAR2, CHAR, DATE, NUMBER, or TIMESTAMP in the database. Inaccordance with an embodiment, a sharded database can also acceptconnections without a shard key or shard group key.

In accordance with an embodiment, to reduce the impact of resharding onsystem performance and data availability, each shard can be subdividedinto smaller pieces or chunks. Each chunk acts as a unit of reshardingthat can be moved from one shard to another. Chunks also simplifyrouting, by adding a level of indirection to the shard key mapping.

For example, each chunk can be automatically associated with a range ofshard key values. A user-provided shard key can be mapped to aparticular chunk, and that chunk mapped to a particular shard. If adatabase operation attempts to operate on a chunk that is not existenton a particular shard, then an error will be raised. When shard groupsare used, each shard group is a collection of those chunks that have aspecific value of shard group identifier.

A shard-aware client application can work with sharded databaseconfigurations, including the ability to connect to one or multipledatabase shards in which the data is partitioned based on one or moresharding methods. Each time a database operation is required, the clientapplication can determine the shard to which it needs to connect.

In accordance with an embodiment, a sharding method can be used to mapshard key values to individual shards. Different sharding methods can besupported, for example: hash-based sharding, in which a range of hashvalues is assigned to each chunk, so that upon establishing a databaseconnection the system applies a hash function to a given value of thesharding key, and calculates a corresponding hash value which is thenmapped to a chunk based on the range to which that value belongs;range-based sharding, in which a range of shard key values is assigneddirectly to individual shards; and list-based sharding, in which eachshard is associated with a list of shard key values.

As illustrated in FIG. 2, in accordance with an embodiment a shardeddatabase 140 can comprise a first database region A (here indicated as“DB East”, DBE) 141, including sharded database instances “DBE-1” 142,with a shard A stored as chunks A1, A2, . . . An; and “DBE-2” 143, witha shard B stored as chunks B1, B2, . . . Bn.

As further illustrated in FIG. 2, in accordance with an embodiment, asecond database region B (here indicated as “DB West”, DBW) 144,includes sharded database instances “DBW-1” 145, with a shard C storedas chunks C1, C2, . . . Cn; and “DBW-2” 146, with a shard D stored aschunks D1, D2, . . . Dn.

In accordance with an embodiment, each database region or group ofsharded database instances can be associated with a shard director orlistener (e.g., an Oracle Global Service Managers (GSM) listener, oranother type of listener). For example, as illustrated in FIG. 2, ashard director or listener 147 can be associated with the first databaseregion A; and another shard director or listener 148 can be associatedwith the second database region B. The system can include a databasedriver (e.g., a JDBC driver) 152 that maintains a shard topology layer154, which over a period of time learns and caches shard key ranges tothe location of each shard in a sharded database.

In accordance with an embodiment, a client application can provide oneor more shard keys to the connection pool during a connection request162; and, based on the one or more shard keys, and information providedby the shard topology layer, the connection pool can route theconnection request to a correct or appropriate shard.

In accordance with an embodiment, the connection pool can also identifya connection to a particular shard or chunk by its shard keys, and allowre-use of a connection when a request for a same shard key is receivedfrom a particular client application.

For example, as illustrated in FIG. 2, in accordance with an embodiment,a connection to a particular chunk (e.g., chunk A1) can be used toconnect 174, to that chunk. If there are no available connections in thepool to the particular shard or chunk, the system can attempt torepurpose an existing available connection to another shard or chunk,and re-use that connection. The data distribution across the shards andchunks in the database can be made transparent to the clientapplication, which also minimizes the impact of re-sharding of chunks onthe client.

When a shard-aware client application provides one or more shard keys tothe connection pool, in association with a connection request; then, ifthe connection pool or database driver already has a mapping for theshard keys, the connection request can be directly forwarded to theappropriate shard and chunk, in this example, to chunk C2.

When a shard-aware client application does not provide a shard key inassociation with the connection request; or if the connection pool ordatabase driver does not have a mapping for a provided shard key; thenthe connection request can be forwarded to an appropriate shard directoror listener.

Multi-Tenant Environments

In accordance with an embodiment, the system can include support forcloud-based or multi-tenant environments using connection labeling. Forexample, a multi-tenant cloud environment can include an applicationserver or database environment that includes or provides access to adatabase for use by multiple tenants or tenant applications, in acloud-based environment.

FIG. 3 further illustrates a system that includes a connection pool,including support for use in a multi-tenant environment, in accordancewith an embodiment.

Software applications, which can be accessed by tenants via a cloud orother network, may, similarly to the environments described above,initialize connections retrieved from a connection pool before using theconnection.

As described above, examples of initialization can include simple statere-initializations that require method calls within the applicationcode, or more complex initializations including database operations thatrequire round trips over a network.

As also described above, labeling connections allows an application toattach arbitrary name/value pairs to a connection, so that theapplication can then request a connection with a desired label from theconnection pool, including the ability to retrieve analready-initialized connection from the pool and avoid the time and costof re-initialization.

As illustrated in FIG. 3, in accordance with an embodiment, amulti-tenant database environment 180 can include, for example, acontainer database (CDB) 181, and one or more pluggable database (PDB),here illustrated as “PDB-1” 182, “PDB-2” 183, and “PDB-3” 184.

In accordance with an embodiment, each PDB can be associated with atenant, here illustrated as “Tenant-1”, “Tenant-2”, and “Tenant-3”, of amulti-tenant application that is either hosted by the application serveror database environment 185, or provided as an external clientapplication 186, and which provides access to the database environmentthrough the use of one or more Oracle Real Application Cluster (RAC)instances 186, 188, including in this example “RAC-Instance-1”, and“RAC-Instance-2”; one or more services, including in this exampleService-1″, “Service-2”, and “Service-3”, and a mapping of tenants toservices 190.

In the example illustrated in FIG. 3, an application being used by atenant to access the database environment, can make connection requestsassociated with that tenant's data source 192, 194, 196, and the systemcan switch services 198 if necessary, to utilize connections to existingRAC instances or PDBs.

Server-Side Connection Pools

In accordance with an embodiment, the system can utilize a server-sideconnection pool tagging feature, such as that provided, for example, byOracle Database Resident Connection Pooling (DROP). A server-sideconnection pool tagging feature allows user applications or clients toselectively obtain a connection to a database environment, based on useof a single tag that is understood by that database environment.

In accordance with an embodiment, only one tag is associated perconnection. The database server does not communicate the tag value tothe user applications or clients, but rather communicates a tag-match(for example, as a Boolean value).

Efficient Connection Validation in the Pool

In accordance with an embodiment, the system can include support forefficient connection validation.

For example, the system can support a “seconds to trust idle connection”functionality, which enables lazy validation of connections in theconnection pool. The seconds to trust idle connection is the timeperiod, expressed, for example, as a number of seconds, within aparticular connection usage, that the connection pool trusts that theconnection is still viable, and if so will skip a connection validationtest before delivering the connection to a requesting application.

Generally, connection pools have a mechanism to validate a connectionwhen the connection is borrowed. The validation process may be turned onby default, to prevent runtime errors from arising; and typicallyrequires a roundtrip to the database in order to validate or test theconnection. The process is computationally expensive, because itrequires a roundtrip to the database, but it improves overall confidencein the connection being connected to the database.

In accordance with an embodiment, the “seconds to trust idle connection”functionality allows a lazy validation of connections in the connectionpool; by indicating the number of seconds within a connection usage thatthe pool trusts that the connection is still viable, and if so, the poolwill skip the connection validation test, before delivering theconnection to an application.

For example, in accordance with an embodiment, the system can instructthe connection pool environment, that it does not need to validate ortest a borrowed connection, if the connection was last used within,e.g., X seconds. In such an example, the connection pool only validatesor tests the borrowed connection if the connection was last used greaterthan X seconds ago.

This provides a performance enhancement in the connection pool,especially during instances of peak traffic, by reducing the impact ofconnection testing.

For example, on a connection borrow request from an application, theconnection pool environment can check the last validated time stamp ofthe connection (i.e., the last time the connection was successfullyused), and, if the difference of current time and last validated time isgreater than the seconds to trust idle connection, then the pool againvalidates the connection; or otherwise the pool trusts that theconnection is still usable, without checking validity.

FIG. 4 illustrates an embodiment which supports connection validation,in a connection pool environment.

As illustrated in FIG. 4, in accordance with an embodiment, a connectionvalidation function 380 can be used by the connection pool to performconnection validation 382.

In accordance with an embodiment, the connection validation function canimprove efficiency of connection validation by selectively validatingconnections, instead of validating each connection that is to beborrowed, thereby improving validation efficiency.

In accordance with an embodiment, to validate a connection, theconnection pool can execute a SQL statement on the connection, orperform an internal ping if a JDBC driver is used.

In accordance with an embodiment, the connection validation feature canbe configured using a plurality of properties on the connection pool, orprogrammatically using a connection validation interface.

For example, the following properties on the connection pool can be usedto configure the connection validation feature:

-   -   setValidateConnectionOnBorrow(Boolean): Specifies whether or not        connections are validated when the connection is borrowed from        the connection pool. The method enables validation for every        connection that is borrowed from the pool. A value of false        means no validation is performed. The default value is false.    -   setSQLForValidateConnection(String): Specifies the SQL statement        that is executed on a connection when it is borrowed from the        pool.        The following example demonstrates validating a connection when        the connection is borrowed from the connection pool. The example        uses Connector/J JDBC driver from MySQL.    -   PoolDataSource pds=PoolDataSourceFactory.getPoolDataSource( );    -   pds.setConnectionFactoryClassName        (“com.mysql.jdbc.jdbc2.optional.    -   MysqlDataSource”);    -   pds.setURL (“jdbc:mysql://host:3306/mysql”);    -   pds.setUser (“<user>”);    -   pds.setPassword (“<password>”);    -   pds.setValidateConnectionOnBorrow(true);    -   pds.setSQLForValidateConnection (“select * from mysql.user”);    -   Connection conn=pds.getConnectionQ;

In accordance with an embodiment, when a JDBC driver (e.g., Oracle JDBCdriver) is used, the setValidateConnectionOnBorrow property can be setto true, and the setSQLForValidateConnection property is not used. Suchconfiguration can enable the connection pool to perform an internalping, which is faster than executing an SQL statement.

Further, the connection validation feature can be configured using aconnection validation interface, for example, theoracle.ucp.jdbc.ValidConnection interface that includes an “isValid”method and a ‘setInvalid” method. The “isValid” method can returninformation indicating whether or not a connection is usable and the“setInvalid” method can be used to indicate that a connection should beremoved from the connection pool instance.

In accordance with an embodiment, in the above example, the “isValidmethod” can be used to check if a connection is still usable after anSQL exception has been thrown. The method can be used anytime to checkif a borrowed connection is valid. The method is particularly useful incombination with a retry mechanism, such as the Fast Connection Failoveractions that are triggered after a down event of Oracle RAC.

In accordance with an embodiment, the “isValid” method can check withthe connection pool instance and a database driver (e.g., Oracle JDBCdriver) to determine whether a connection is still valid. The “isValid”method can result in a round-trip to the database only if both theconnection pool instance and the database driver report that aconnection is still valid. The round-trip is used to check for databasefailures that are not immediately discovered by the pool or the driver.

In accordance with an embodiment, the “isValid” method can be used inconjunction with the connection timeout and connection harvestingfeatures. These features may return a connection to the connection poolwhile the connection is being held by an application. In such cases, the“isValid” method returns false, allowing the application to get a newconnection.

Regardless of how the connection validation feature is configured, theconnection validation feature can ensure that a connection is validbefore the connection pool hands the connection to the clientapplication 130. Without the connection validation feature, a borrowedconnection may be invalid, for example, in case of network outage andserver crash, and runtime errors caused by the invalid connection may behard to debug.

However, the connection validation feature can generate a large ofamount of traffic, thereby slowing down application performance. Theconnection validation function 380 can be used by the connection pool toimprove application performance by minimize the impact of frequentconnection validation.

FIG. 5 further illustrates an embodiment which supports connectionvalidation, in a connection pool environment.

As illustrated in FIG. 5, in accordance with an embodiment, the systemdetermines 384, for a connection to be returned, if the (differencebetween the current time and the last validated time stamp) is less thanthe seconds to trust idle connection value, and if so then theconnection is returned without checking validity.

In accordance with an embodiment, the system can enable the connectionto skip validating those connections that have been recently used withina configurable period of time. System performance can be improved due tothe less amount of traffic generated in validating the connections.

In one use case, for example, the connection pool may can reuse a shortlist of connections to keep the cache hot, whereas the rest of theconnections (less frequently used connections) may be maintained in theconnection pool for peak usage.

In accordance with an embodiment, the seconds to trust idle connectionvalue can be set, so that the less frequently connections can bevalidated.

For example, the connections in the connection pool may need to passthrough a firewall to connect to the database. The firewall may have atimeout setting that can drop the one or more two connections. One ormore of the less frequently connections may be idle for a period of timethat exceeds the firewall timeout period.

In accordance with an embodiment, in the above example, if the secondsto trust idle connection value is set based on the firewall timeoutperiod, the connection pool can be configured to detect a connectiondropped by the firewall.

FIG. 6 further illustrates an embodiment which supports connectionvalidation, in a connection pool environment.

As shown in FIG. 6, in accordance with an embodiment, the connectionpool can include a connection validation indicator 611, a seconds totrust Idle connections value 613, and a last validated time 601, 603,605, 607 for each of the plurality of connections in the connectionpool.

In accordance with an embodiment, the connection validation indicatorcan be set by a method that takes a Boolean value as a parameter, forexample, setValidateConnectionOnBorrow(Boolean). When the method is setto true, each connection in the connection pool is validated during thecheckout. As mentioned above, this validation may incur significantoverhead in applications that checkout database connections frequently.

In accordance with an embodiment, the seconds to trust idle connectionsvalue can be set by a method that takes an integer as a parameter, forexample, setSecondsToTrustIdleConnection(int); and can be used tominimize the impact of frequent connection validation. When the secondsto trust idle connections value is set appropriately, connections thatare recently used or recently validated/tested can be trusted, and arenot to be validated during their checkout. Thus, the time to trustparameter can be used to skip testing connections and improveapplication performance.

In accordance with an embodiment, if the seconds to trust idleconnections value is set to positive, the connection validation isskipped for connections that were used within the time specified by theseconds to trust idle connections value, for example, 5 seconds. Thedefault seconds to trust idle connections value is set to 0, which canindicate that the connection validation feature is disabled.

In accordance with an embodiment, the seconds to trust idle connectionsvalue can enable the connection pool to skip the validation test onconnections only if the connection validation indicator is set to true.If the seconds to trust idle connections value is set to positivewithout setting the connection validation indicator to true, theconnection pool can throw an exception indicating that the seconds totrust idle connections value is invalid.

As an illustrative example, when the client application requests 632 aconnection from the connection pool, the connection pool can check thelast validated time stamp of the connection (i.e., the last time theconnection was successfully used), and, if the difference of currenttime and last validated time is greater than the seconds to trust idleconnection, then the pool again validates the connection; or otherwisethe pool trusts that the connection is still usable, without checkingvalidity, and return 684 the connection to the client application.

FIG. 7 illustrates a process for providing connection validation, inaccordance with an embodiment.

As shown in FIG. 7, at step 711, a connection borrow request from anapplication is received at a connection pool that includes a connectionvalidation indicator and a seconds to trust Idle connections.

At step 713, in response to the connection borrow request, theconnection pool selects an idle connection from the connection pool tobe returned to the application.

At step 715, the connection pool determines whether the connectionvalidation indicator has been set to true or not. If the connectionvalidation indicator has not been set to true, the connection poolreturns the selected connection without validating the connection asshown at step 723.

At step 717, after determining that the connection validation indicatorhas been set to true, the connection pool further determines whether thevalue of the seconds to trust idle connections is positive. If not, theconnection pool return the selected connection without validating it.

At step 719, after determining that the value of the seconds to trustidle connections is positive, the connection pool further determines theperiod of time that has elapsed since the last validated time associatedwith the selected connection.

At step 721, the connection pool determines whether the period of timethat has elapsed since the last validated time associated with theselected connection is longer than the value of the seconds to trustidle connections. If it is not longer than the value of the seconds totrust idle connections, the connection pool can return the selectedconnection without validating it, as shown at step 723.

At step 725, in response to determining that the period of time that haselapsed is longer than the value of the seconds to trust idleconnections, the connection pool validates the selected connection byeither executing a SQL statement on the connection, or performing aninternal ping.

At step 727, the connection pool updates the last validated timeassociated with the connection, with the time when the connection isvalidated as described at step 725.

FIG. 8 illustrates a method of providing connection validation, in aconnection pool environment, in accordance with an embodiment.

As illustrated in FIG. 8, at step 890, at an application server ordatabase environment, a connection pool logic or program code isprovided that controls the creation and use of connection objects in aconnection pool, wherein software applications can request a connectionfrom the connection pool, and use a provided connection to access adatabase.

At step 892, the system determines a “seconds to trust idle connection”value, which allows a lazy validation of connections in the pool,wherein the seconds to trust idle connection is the period of timewithin a connection usage that the pool trusts that a particularconnection is still viable, and will skip the connection validation testbefore delivering it to a requesting application.

At step 894, a connection borrow request is received from anapplication.

At step 896, the connection pool checks a last-validated time stamp ofthe requested connection (i.e., the last time the connection wassuccessfully used), and if the difference between a current time and thelast-validated time is greater than the seconds to trust idle connectionvalue, then the pool again validates the connection; otherwise it truststhat the connection is still viable, and returns it to the requestingapplication without checking validity.

While various embodiments of the present invention have been describedabove, it should be understood that they have been presented by way ofexample, and not limitation. The embodiments were chosen and describedin order to explain the principles of the invention and its practicalapplication. The embodiments illustrate systems and methods in which thepresent invention is utilized to improve the performance of the systemsand methods by providing new and/or improved features and/or providingbenefits such as reduced resource utilization, increased capacity,improved efficiency, and reduced latency.

In some embodiments, features of the present invention are implemented,in whole or in part, in a computer including a processor, a storagemedium such as a memory and a network card for communicating with othercomputers. In some embodiments, features of the invention areimplemented in a distributed computing environment in which one or moreclusters of computers is connected by a network such as a Local AreaNetwork (LAN), switch fabric network (e.g. InfiniBand), or Wide AreaNetwork (WAN). The distributed computing environment can have allcomputers at a single location or have clusters of computers atdifferent remote geographic locations connected by a WAN.

In some embodiments, features of the present invention are implemented,in whole or in part, in the cloud as part of, or as a service of, acloud computing system based on shared, elastic resources delivered tousers in a self-service, metered manner using Web technologies. Thereare five characteristics of the cloud (as defined by the NationalInstitute of Standards and Technology: on-demand self-service; broadnetwork access; resource pooling; rapid elasticity; and measuredservice. See, e.g. “The NIST Definition of Cloud Computing”, SpecialPublication 800-145 (2011) which is incorporated herein by reference.Cloud deployment models include: Public, Private, and Hybrid. Cloudservice models include Software as a Service (SaaS), Platform as aService (PaaS), Database as a Service (DBaaS), and Infrastructure as aService (IaaS). As used herein, the cloud is the combination ofhardware, software, network, and web technologies which delivers sharedelastic resources to users in a self-service, metered manner. Unlessotherwise specified the cloud, as used herein, encompasses public cloud,private cloud, and hybrid cloud embodiments, and all cloud deploymentmodels including, but not limited to, cloud SaaS, cloud DBaaS, cloudPaaS, and cloud IaaS.

In some embodiments, features of the present invention are implementedusing, or with the assistance of hardware, software, firmware, orcombinations thereof. In some embodiments, features of the presentinvention are implemented using a processor configured or programmed toexecute one or more functions of the present invention. The processor isin some embodiments a single or multi-chip processor, a digital signalprocessor (DSP), a system on a chip (SOC), an application specificintegrated circuit (ASIC), a field programmable gate array (FPGA) orother programmable logic device, state machine, discrete gate ortransistor logic, discrete hardware components, or any combinationthereof designed to perform the functions described herein. In someimplementations, features of the present invention may be implemented bycircuitry that is specific to a given function. In otherimplementations, the features may implemented in a processor configuredto perform particular functions using instructions stored e.g. on acomputer readable storage media.

In some embodiments, features of the present invention are incorporatedin software and/or firmware for controlling the hardware of a processingand/or networking system, and for enabling a processor and/or network tointeract with other systems utilizing the features of the presentinvention. Such software or firmware may include, but is not limited to,application code, device drivers, operating systems, virtual machines,hypervisors, application programming interfaces, programming languages,and execution environments/containers. Appropriate software coding canreadily be prepared by skilled programmers based on the teachings of thepresent disclosure, as will be apparent to those skilled in the softwareart.

In some embodiments, the present invention includes a computer programproduct which is a storage medium or computer-readable medium (media)having instructions stored thereon/in, which instructions can be used toprogram or otherwise configure a system such as a computer to performany of the processes or functions of the present invention. The storagemedium or computer-readable medium can include, but is not limited to,any type of disk including floppy disks, optical discs, DVD, CD-ROMs,microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs,DRAMs, VRAMs, flash memory devices, magnetic or optical cards,nanosystems (including molecular memory ICs), or any type of media ordevice suitable for storing instructions and/or data. In particularembodiments, the storage medium or computer-readable medium is anon-transitory storage medium or non-transitory computer readablemedium.

The foregoing description is not intended to be exhaustive or to limitthe invention to the precise forms disclosed. Additionally, whereembodiments of the present invention have been described using aparticular series of transactions and steps, it should be apparent tothose skilled in the art that the scope of the present invention is notlimited to the described series of transactions and steps. Further,where embodiments of the present invention have been described using aparticular combination of hardware and software, it should be recognizedthat other combinations of hardware and software are also within thescope of the present invention. Further, while the various embodimentsdescribe particular combinations of features of the invention it shouldbe understood that different combinations of the features will beapparent to persons skilled in the relevant art as within the scope ofthe invention such that features of one embodiment may incorporated intoanother embodiment. Moreover, it will be apparent to persons skilled inthe relevant art that various additions, subtractions, deletions,variations, and other modifications and changes in form, detail,implementation and application can be made therein without departingfrom the spirit and scope of the invention. It is intended that thebroader spirit and scope of the invention be defined by the followingclaims and their equivalents.

What is claimed is:
 1. A system for providing access to a database in amulti-tenant environment, including support for connection validation,comprising: a computer including a processor; wherein the computercontrols creation and use of connection objects in a connection poolthat enables software applications to request a connection from theconnection pool, and use a provided connection to access a database; andwherein the system comprises functionality for connection validation inthe connection pool.
 2. The system of claim 1, further comprising:wherein the system comprises functionality for connection validation inthe connection pool, including determination of a seconds to trust idleconnection time period, within a particular connection usage, that theconnection pool trusts that the connection is still viable, and if sothen skipping a connection validation test before delivering theconnection to a requesting application.
 3. The system of claim 1,wherein the connection pool environment checks the last validated timestamp of the connection, to determine whether to trust an idleconnection.
 4. The system of claim 1, wherein the connection poolenvironment checks the last validated time stamp of the connection, and,if the difference of current time and last validated time is greaterthan the seconds to trust idle connection, then the pool again validatesthe connection; or otherwise the connection pool trusts that theconnection is still usable, without checking validity.
 5. The system ofclaim 1, wherein the connection pool is configured that it does not needto test a borrowed connection, if the connection was last used within aparticular amount of time.
 6. The system of claim 1, wherein theconnection validation test is performed by the connection pool thatexecutes a SQL statement on a connection, or performs an internal pingif a JDBC driver is used.
 7. A method for providing access to a databasein a multi-tenant environment, including support for connectionvalidation, comprising: providing, at a computer including a processor,a connection pool that includes connection objects and that enablessoftware applications to request a connection from the connection pool,and use a provided connection to access a database; and performingconnection validation in the connection pool.
 8. The method of claim 7,further comprising: performing connection validation in the connectionpool, including determining a seconds to trust idle connection timeperiod, within a particular connection usage, that the connection pooltrusts that the connection is still viable, and if set, then skipping aconnection validation test before delivering the connection to arequesting application.
 9. The method of claim 7, wherein the connectionpool environment checks the last validated time stamp of the connection,to determine whether to trust an idle connection.
 10. The method ofclaim 7, wherein the connection pool environment checks the lastvalidated time stamp of the connection, and, if the difference ofcurrent time and last validated time is greater than the seconds totrust idle connection, then the pool again validates the connection; orotherwise the connection pool trusts that the connection is stillusable, without checking validity.
 11. The method of claim 7, whereinthe connection pool is configured that it does not need to test aborrowed connection, if the connection was last used within a particularamount of time.
 12. The method of claim 7, wherein the connectionvalidation test is performed by the connection pool that executes a SQLstatement on a connection, or performs an internal ping if a JDBC driveris used.
 13. A non-transitory computer readable storage medium,including instructions stored thereon which when read and executed byone or more computers cause the one or more computers to perform themethod comprising: providing, at a computer including a processor, aconnection pool that includes connection objects and that enablessoftware applications to request a connection from the connection pool,and use a provided connection to access a database; and performingconnection validation in the connection pool.
 14. The non-transitorycomputer readable storage medium of claim 13, further comprising:performing connection validation in the connection pool, includingdetermining a seconds to trust idle connection time period, within aparticular connection usage, that the connection pool trusts that theconnection is still viable, and if set, then skipping a connectionvalidation test before delivering the connection to a requestingapplication.
 15. The non-transitory computer readable storage medium ofclaim 13, wherein the connection pool environment checks the lastvalidated time stamp of the connection, to determine whether to trust anidle connection.
 16. The non-transitory computer readable storage mediumof claim 13, wherein the connection pool environment checks the lastvalidated time stamp of the connection, and, if the difference ofcurrent time and last validated time is greater than the seconds totrust idle connection, then the pool again validates the connection; orotherwise the connection pool trusts that the connection is stillusable, without checking validity.
 17. The non-transitory computerreadable storage medium of claim 13, wherein the connection pool isconfigured that it does not need to test a borrowed connection, if theconnection was last used within a particular amount of time.
 18. Thenon-transitory computer readable storage medium of claim 13, wherein theconnection validation test is performed by the connection pool thatexecutes a SQL statement on a connection, or performs an internal pingif a JDBC driver is used.